unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, RzTray,Inifiles;

type
  TForm1 = class(TForm)
    Button1: TButton;
    RzTrayIcon1: TRzTrayIcon;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  setini_file: TIniFile;
  UU,IP:string;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var str:string;
begin
  str:='net time \\'+trim(IP)+' /set /y';
  WinExec(PChar(str),0);
  Application.Terminate;
end;

procedure TForm1.FormCreate(Sender: TObject);
var str :string;
begin
setini_file := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'set.ini');
UU:=setini_file.ReadString('UU', 'UUP', '');
IP:=setini_file.ReadString('ip', 'ServerIP', '');
Label2.Caption :=ip;
str:='net use \\'+trim(IP)+' /user:administrator '+UU;
WinExec(PChar(str),0);
Button1.Click;
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var str :string;
begin
str:='net use \\'+trim(IP)+' /user:administrator '+UU;
if Key=#13 then begin
    WinExec(PChar(str),0);
    Button1.SetFocus;
end;
end;

end.
